package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Award;

public class AwardDaoImpl extends HibernateDaoSupport implements AwardDao {

	public void save(Award award) {
		getSession().saveOrUpdate(award);
	}

	public Award load(int id) {
		Award award = (Award)getSession().load(Award.class, id);
		return award;
	}
	
	
	public List<Award> loadAll() {
		Query query = getSession().createQuery("from Award");
		query.setCacheable(true);
		List<Award> list = (List<Award>)query.list();
		return list;
	}
	
}
